package com.insideClass;

import java.util.ArrayList;

class Apple{
    private static long counter;
    private final long id =counter++;
    public long id(){
        return id;
    }
}
class Orange{ }
/**
 * @author 13699
 */
public class ApplesAndOrangesWithoutGenerics {
    /**
     * @SuppressWarnings("unchecked")
     * 表示只有有关"不收检查的异常"的警告信息应该被抑制
     * @param args
     */
    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        ArrayList apples=new ArrayList();
        for(int i=0;i<3;i++){
            apples.add(new Apple());
        }
        apples.add(new Orange());
        for(int i=0;i<apples.size();i++){
            ((Apple)apples.get(i)).id();
        }
    }
}
